<template>
  <div class='cssDevelop'>
    <div class='cssDevelop-box'>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>使用writing-mode排版竖文</div>
        <div class="item-div vertical-text">
          <h3>将进酒·君不见</h3>
          <div>君不见，黄河之水天上来，奔流到海不复回。</div>
          <div>君不见，高堂明镜悲白发，朝如青丝暮成雪。</div>
          <div>人生得意须尽欢，莫使金樽空对月。</div>
          <div>天生我材必有用，千金散尽还复来。</div>
          <div>2024-07-15</div>
        </div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>使用text-align-last对齐两端文本</div>
        <div class='item-div justify-text'>
          <div>账号</div>
          <div>密码</div>
          <div>电子邮件</div>
          <div>通讯地址</div>
        </div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>使用caret-color改变光标颜色</div>
        <form class="form-validation">
          <div>
            <label>名字</label>
            <input type="text" placeholder="请输入你的名字(1到10个中文)" pattern="^[\u4e00-\u9fa5]{1,10}$" required>
          </div>
          <div>
            <label>手机</label>
            <input type="text" placeholder="请输入你的手机" pattern="^1[3456789]\d{9}$" required>
          </div>
        </form>
      </div>
    </div>
    <div class='cssDevelop-box'>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>CSS边框动画</div>
        <div class='item-div css-div'></div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>CSS虚线边框动画</div>
        <div class='item-div css-div1'></div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>渐变的其他妙用</div>
        <div class='item-div rainbow'></div>
      </div>
    </div>
    <div class='cssDevelop-box'>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>conic-gradient 的妙用</div>
        <div class='item-div conic-box'>
          <div class="conic conic-demo"></div>
        </div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>clip-path 的妙用</div>
        <div class='item-div clip-path'>
          <div>CodePen - clip-path</div>
          <div>animation</div>
        </div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>clip-path 的妙用</div>
        <div class='item-div clip-path1'>Hello</div>
      </div>
    </div>
    <div class='cssDevelop-box'>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>overflow 的妙用</div>
        <div class='item-div overflow-box'>Hover Me</div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>border-image 使用渐变</div>
        <div class='item-div border-image-clip-path'></div>
      </div>
      <div class='cssDevelop-box-item'>
        <div class='item-title'>CSS炫酷的文字阴影样式</div>
        <div class='item-div deepshadow Shadow'>Deep Shadow</div>
        <div class='item-div insetshadow Shadow'>Inset Shadow</div>
        <div class='item-div retroshadow Shadow'>Retro Shadow</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">

</script>

<style scoped lang='scss'>
  .cssDevelop{
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    text-align: left;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 20px;
  }
  .justify-text>div {
    padding: 0 20px;
    width: 200px;
    height: 40px;
    background-color: #f66;
    line-height: 40px;
    text-align-last: justify;
    color: #fff;
  }
  .justify-text>div + div {
    margin-top: 5px;
  }
  .vertical-text {
    writing-mode: vertical-rl;
    text-orientation: upright;
  }
  .vertical-text>h3 {
    padding-left: 20px;
    font-weight: bold;
    font-size: 18px;
    color: #f66;
  }
  .vertical-text>div {
    line-height: 30px;
    color: #66f;
  }
  .cssDevelop-box{
    display: flex;
    margin-bottom: 20px;
  }
  .cssDevelop-box-item{
    width: calc((100% - 40px) / 3);
    padding-bottom: 20px;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(98,107,181,.25);
    border-radius: 20px;

    &+.cssDevelop-box-item{
      border-left: 1px solid rgba(98,107,181,.15);
      margin-left: 20px;
    }

    .item-title{
      height: 60px;
      line-height: 60px;
      font-size: 20px;
      font-weight: bold;
      border-bottom: 1px solid rgba(98,107,181,.15);
      text-indent: 60px;
      background: #f2f2f2;
      border-radius:20px 20px 0 0 ;
      position: relative;

      &:before{
        content: '';
        width: 16px;
        height: 16px;
        background: #adb0b6;
        position: absolute;
        top: 22px;
        left: 30px;
        border-radius: 8px;
      }
    }

    .item-div{
      margin-left: 20px;
      padding: 20px;
    }

  }
  .form-validation {
    padding: 20px 40px;
    div + div {
      margin-top: 20px;
    }
    label {
      display: block;
      padding-bottom: 5px;
      font-weight: bold;
      font-size: 16px;
    }
    input,
    textarea {
      display: block;
      padding: 0 20px;
      border: 1px solid #ccc;
      width: calc(100% - 80px);
      height: 40px;
      outline: none;
      caret-color: #09f;
      transition: all 300ms;
      border-radius: 10px;
      &:focus:invalid {
        border-color: #f66;
      }
    }
  }
  .css-div{
    width: 300px;
    height: 200px;
    position: relative;
    border: 1px solid #1884f3;
    box-sizing: border-box;
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;

    &::before,
    &::after {
      content: "";
      position: absolute;
      width: 30px;
      height: 30px;
    }

    &::before {
      top: -5px;
      left: -5px;
      border-top: 1px solid #1884f3;
      border-left: 1px solid #1884f3;
    }

    &::after {
      right: -5px;
      bottom: -5px;
      border-bottom: 1px solid #1884f3;
      border-right: 1px solid #1884f3;
    }

    &:hover::before,
    &:hover::after {
      width: calc(100% + 9px);
      height: calc(100% + 9px);
    }
  }
  .css-div1{
    width: 300px;
    height: 200px;
    position: relative;
    box-sizing: border-box;
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;
    background: linear-gradient(90deg, #333 50%, transparent 0) repeat-x,
                linear-gradient(90deg, #333 50%, transparent 0) repeat-x,
                linear-gradient(0deg, #333 50%, transparent 0) repeat-y,
                linear-gradient(0deg, #333 50%, transparent 0) repeat-y;
    background-size: 4px 1px, 4px 1px, 1px 4px, 1px 4px;
    background-position: 0 0, 0 100%, 0 0, 100% 0;
    animation: linearGradientMove .3s infinite linear;
  }
  .rainbow{
    position: relative;
    z-index: 0;
    width: 300px;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    padding: 2rem;
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;

    &::before {
      content: '';
      position: absolute;
      z-index: -2;
      left: -50%;
      top: -50%;
      width: 200%;
      height: 200%;
      background-color: #399953;
      background-repeat: no-repeat;
      background-size: 50% 50%, 50% 50%;
      background-position: 0 0, 100% 0, 100% 100%, 0 100%;
      background-image: linear-gradient(#399953, #399953),
                        linear-gradient(#fbb300, #fbb300),
                        linear-gradient(#d53e33, #d53e33),
                        linear-gradient(#377af5, #377af5);
      animation: rotate 4s linear infinite;
    }

    &::after {
      content: '';
      position: absolute;
      z-index: -1;
      left: 6px;
      top: 6px;
      width: calc(100% - 12px);
      height: calc(100% - 12px);
      background: rgba(255, 255, 255, 0.9);
      border-radius: 5px;
    }
  }
  .conic-box{
    .conic {
      position: relative;
      z-index: 0;
      width: 300px;
      height: 200px;
      margin: 20px;
      border-radius: 10px;
      overflow: hidden;
      padding: 2rem;

      &::before {
        content: '';
        position: absolute;
        z-index: -2;
        left: -50%;
        top: -50%;
        width: 200%;
        height: 200%;
        background-color: #1a232a;
        background-repeat: no-repeat;
        background-position: 0 0;
        background-image: conic-gradient(transparent, #55DFFF, transparent 30%);
        animation: rotate 4s linear infinite;
      }

      &::after {
        content: '';
        position: absolute;
        z-index: -1;
        left: 10px;
        top: 10px;
        width: calc(100% - 20px);
        height: calc(100% - 20px);
        background: #000;
        border-radius: 5px;
      }
    }
    .conic-demo::after {
      animation: opacityChange 5s infinite linear;
    }
  }
  .clip-path{
    position: relative;
    margin: auto;
    width: 300px;
    height: 200px;
    text-align: center;
    font-size: 24px;
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;
    background: #f0f0f0;
    padding-top: 60px !important;

    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border: 4px solid #6df5ff;
      transition: all .5s;
      animation: clippath 3s infinite linear;
    }

  }
  .clip-path1{
    width: 300px;
    height: 200px;
    line-height: 150px;
    text-align: center;
    color: #fff;
    font-size: 40px;
    border: 2px solid gold;
    border-radius: 10px;
    background: gold;
    cursor: pointer;
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;
    filter: contrast(1.1);

    &:active {
      filter: contrast(0.9);
    }

    &::before,
    &::after {
      content: "";
      position: absolute;
      top: -10px;
      left: -10px;
      right: -10px;
      bottom: -10px;
      border: 2px solid gold;
      transition: all .5s;
      animation: clippath1 3s infinite linear;
      border-radius: 10px;
    }

    &::after {
      animation: clippath1 3s infinite -1.5s linear;
    }
  }
  .overflow-box{
    position: relative;
    margin: auto;
    width: 300px;
    height: 200px;
    text-align: center;
    overflow: hidden;
    filter: contrast(1.2);
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;
    background: #ffffff;

    &::after {
      content: "Hover Me";
      position: absolute;
      top: 4px;
      bottom: 4px;
      right: 4px;
      left: 4px;
      line-height: 180px;
      font-size: 24px;
      background: yellowgreen;
      border: 2px solid #ffffff;
      cursor: pointer;
      color: #ffffff;
    }

    &::before {
      content: "";
      position: absolute;
      top: 0px;
      bottom: 0px;
      right: -20px;
      left: 0px;
      background: yellowgreen;
      transform: rotateZ(-90deg) translate(-100%, -100%);
      transform-origin: top left;
      transition: transform .3s;
      transition-timing-function: linear;
    }

    &:hover::before {
      transform: rotateZ(0deg) translate(0%, -0%);
    }
  }
  .border-image-clip-path {
    width: 300px;
    height: 200px;
    margin: auto;
    border: 10px solid;
    border-image: linear-gradient(45deg, gold, deeppink) 1;
    clip-path: inset(0px round 10px);
    animation: huerotate 6s infinite linear;
    filter: hue-rotate(360deg);
    margin-top: 40px;
    margin-left: 60px !important;
    margin-bottom: 40px;
  }
  .deepshadow{
    color: #e0dfdc;
    background-color: #333;
    letter-spacing: 0.1em;
    text-shadow: 0 -1px 0 #fff,
                  0 1px 0 #8e8e8e,
                  0 2px 0 #737373,
                  0 3px 0 #5d5d5d,
                  0 4px 0 #474747,
                  0 5px 0 #333333,
                  0 6px 0 #1d1d1d,
                  0 7px 0 #181818,
                  0 8px 0 #161616,
                  0 9px 0 #141414,
                  0 10px 0 #121212,
                  0 11px 30px rgba(0, 0, 0, 0.9);
  }
  .insetshadow{
    color: #202020;
    background-color: #2d2d2d;
    letter-spacing: 0.1em;
    text-shadow: -1px -1px 1px #000, 2px 2px 1px #363636;
  }
  .retroshadow{
    color: #2c2c2c;
    background-color: #d5d5d5;
    letter-spacing: 0.05em;
    text-shadow: 2px 2px 0 #d5d5d5, 4px 4px 0 rgba(0, 0, 0, 0.2);
  }
  .Shadow{
    width: 90%;
    margin: 20px auto;
    font-size: 30px;
    text-align: center;
    text-transform: uppercase;
    text-rendering: optimizeLegibility;
  }
  @keyframes huerotate {
    0% {
      filter: hue-rotate(0deg);
    }
    100% {
      filter: hue-rorate(360deg);
    }
  }
  @keyframes linearGradientMove {
    100% {
      background-position: 4px 0, -4px 100%, 0 -4px, 100% 4px;
    }
  }
  @keyframes rotate {
    100% {
      transform: rotate(1turn);
    }
  }
  @keyframes opacityChange {
    25% {
      opacity:.6;
    }
    50% {
      opacity:0.8;
    }
    75% {
      opacity:.6;
    }
    100% {
      opacity:0.8;
    }
  }
  @keyframes clippath {
    0%,
    100% {
      clip-path: inset(0 0 95% 0);
    }

    25% {
      clip-path: inset(0 95% 0 0);
    }
    50% {
      clip-path: inset(95% 0 0 0);
    }
    75% {
      clip-path: inset(0 0 0 95%);
    }
  }
  @keyframes clippath1 {
    0%,
    100% {
      clip-path: inset(0 0 98% 0);
    }

    25% {
      clip-path: inset(0 98% 0 0);
    }
    50% {
      clip-path: inset(98% 0 0 0);
    }
    75% {
      clip-path: inset(0 0 0 98%);
    }
  }
</style>
